﻿<UserControl x:Class="BillsManager.Views.DialogView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:Micro="http://www.caliburnproject.org"
             xmlns:ViewModels="clr-namespace:BillsManager.ViewModels;assembly=BillsManager.ViewModels"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             MinWidth="270"
             MinHeight="120"
             MaxWidth="550"
             d:DataContext="{d:DesignInstance Type=ViewModels:DialogViewModel,
                                              IsDesignTimeCreatable=True}"
             mc:Ignorable="d">

    <UserControl.Resources>
        <!--<ResourceDictionary Source="/BillsManager.Views;component/Dictionaries/Styles.xaml" />-->
        <ResourceDictionary Source="/BillsManager.Views;component/Themes/Themes.xaml" />
    </UserControl.Resources>

    <UserControl.Background>
        <Binding Mode="OneTime" Source="{StaticResource View.Background}" />
    </UserControl.Background>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="{StaticResource View.Region.Spacing.Large}" />
            <ColumnDefinition />
            <ColumnDefinition Width="{StaticResource View.Region.Spacing.Large}" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="{StaticResource View.Region.Spacing.Medium}" />
            <RowDefinition />
            <RowDefinition Height="{StaticResource View.Region.Spacing.Medium}" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="{StaticResource View.MarginSize}" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="1"
                   Grid.Column="1"
                   HorizontalAlignment="Left"
                   VerticalAlignment="Center"
                   Text="{Binding Message}"
                   TextAlignment="Left" />

        <Grid Grid.Row="3" Grid.ColumnSpan="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="{StaticResource View.Region.Spacing.Normal}" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <ItemsControl Grid.Column="2"
                          Focusable="False"
                          ItemsSource="{Binding Responses}">

                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>

                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <StackPanel.Margin>
                                <Thickness Right="{StaticResource View.MarginSize.Value}" />
                            </StackPanel.Margin>
                            <CheckBox VerticalAlignment="Center"
                                      Content="{Binding ConfirmCheckText}"
                                      IsChecked="{Binding IsEnabled}"
                                      Visibility="{Binding UseConfirmCheck,
                                                           Converter={StaticResource BooleanToVisibilityConverter}}">
                                <CheckBox.Margin>
                                    <Thickness Left="{StaticResource View.MarginSize.Value}" />
                                </CheckBox.Margin>
                            </CheckBox>
                            <Button MinWidth="80"
                                    Content="{Binding Text}"
                                    IsCancel="{Binding IsCancel}"
                                    IsDefault="{Binding IsDefault}"
                                    IsEnabled="{Binding IsEnabled}"
                                    Micro:Message.Attach="Respond($dataContext)" />
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>

            </ItemsControl>

        </Grid>

    </Grid>
</UserControl>
